
<?php
   $uri = $_SERVER['REQUEST_URI'];
   $req = explode('?', $uri);

    $where=$req['1'];
	session_start();
	$user = isset($_SESSION['user'])?$_SESSION['user']:false;
	require_once $_SERVER['DOCUMENT_ROOT'].'/myblog1/lib/Db.php';
    $db = new Db();
$data = $db->table('article')->where($where)->field('contents,title,add_time')->lists ();
	?>
<!DOCTYPE html>
<html>
<head>
	<title>博客详情</title>
	<link rel="stylesheet" type="text/css" href="./static/css/site.css">
	<link rel="stylesheet" type="text/css" href="./static/plugins/bootstrap/css/bootstrap.min.css">
	<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
</head>
<body>
	<!--header-->
	<div class="header">
		<div class="container">
			<span class="title">刘永鹏的博客</span>
			<div class="search">
				<div class="input-group">
				  <input type="text" class="form-control" placeholder="输入博客名称搜索">
				  <span class="input-group-btn">
			        <button class="btn btn-default" type="button">搜索</button>
			      </span>
				</div>
			</div>
			<div class="login-reg">
                <?php if($user){?>
                    <span style="color:#fff;"><?php echo $user['username']?></span><a href="javascript:;" onclick="logout()">退出</a>
                <?php }else{?>
                    <button class="btn btn-success" onclick="login()">登录</button>
                <?php }?>
				<button class="btn btn-warning">发布博客</button>
			</div>
		</div>
	</div>

	<!--main-->
	<div class="container main">
		<div class="col-lg-3 content-left">
			<p class="cate">博客分类</p>
			<div class="cate-list">
				<p><a href="./index.php">编程语言</a></p>
				<p><a href="">软件设计</a></p>
				<p><a href="">Web前端</a></p>
				<p><a href="">企业信息化</a></p>
				<p><a href="">安卓开发</a></p>
				<p><a href="">IOS开发</a></p>
				<p><a href="">软件工程</a></p>
				<p><a href="">数据库技术</a></p>
				<p><a href="">操作系统</a></p>
				<p><a href="">其他分类</a></p>
			</div>
		</div>
		<div class="col-lg-9">

			<div class="art-title">
                <?php
                echo $data[0]['title'];
                ?>
            </div>
			<div class="art-time"><?php echo date('Y-m-d H:i:s', $data[0]['add_time'])?></div>
			<hr>

			<div class="content-detail">
                <?php
                       echo htmlspecialchars_decode($data[0]['contents']);
                ?>

			</div>
		</div>
	</div>
</body>
</html>
<script type="text/javascript">

</script>